/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package test.beni;


import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import word.api.interfaces.IDocument;
import word.utils.Utils;
import word.w2004.Document2004;
import word.w2004.elements.BreakLine;
import word.w2004.elements.Heading1;
import word.w2004.elements.Image;


import word.w2004.elements.Paragraph;
import word.w2004.elements.Table;
import word.w2004.elements.tableElements.TableEle;

/**
 *
 * @author beni
 */
public class java2word {
        
    
    public static void main(String[] args) {
        IDocument myDoc = new Document2004();
        //http://www.utf8-zeichentabelle.de/
        
        Table tbl1 = new Table();
        String lineBreak = "\n<w:p wsp:rsidR=\"008979E8\" wsp:rsidRDefault=\"008979E8\"/>";
        String linien = new String();
        //no break space &#160;
        //http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
                
        linien = Image.from_CLASSPATH("/gomz/img/line3.png").setHeight("20").setWidth("124").getContent() + lineBreak + "linie2"+ lineBreak + "linie3"+ lineBreak + "linie4"+ lineBreak + "linie5"+ lineBreak + "linie6";
        String informations = lineBreak + "Titel: " + "asdfTitelfdassadfsdakjfsdafsdadsdafasdfsadfasdfsdafsdafjjfjfjfjfjffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"+ lineBreak + "User: " + "asdfUsername" + lineBreak + "Von: " + "asdfDatum";
        

        tbl1.addTableEle(TableEle.TD, linien, informations);
        myDoc.addEle(tbl1);
        
         myDoc.addEle(BreakLine.times(1).create());
        
        Table tbl2 = new Table();
        tbl2.addTableEle(TableEle.TD, "Frage: " + lineBreak + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
        tbl2.addTableEle(TableEle.TD, "Analysis: " + lineBreak + "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
        
        myDoc.addEle(tbl2);
        
        //tbl.getContent().replace(oldChar, newChar)


        
        
        
                try {
                    PrintWriter writer = new PrintWriter(new File("C:\\tmp\\Awesome.doc"));
                    writer.println(myDoc.getContent());
                    writer.close();
                    
                } 
                catch (Exception e) {
                    e.printStackTrace();
                    
                }        
    }
    public boolean createWord(){


        
        
        return false;
    }
    
}
